home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-07
/
book.exe
/
LAN.H
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-02
|
5KB
|
161 lines
/*
// LAN.H Header file for LAN utility. Included in all modules.
//
// (c) Copyright 1991 Adrian King.
//
//
// This code was developed for inclusion in the book
// "Running LANtastic", by Adrian King, published by
// Bantam Books, October 1991.
//
// $Header: F:/LANBOOK/SRC/LAN/VCS/LAN.H_V 1.0 13 Jul 1991 11:19:12 $
//
// $Log: F:/LANBOOK/SRC/LAN/VCS/LAN.H_V $
//
// Rev 1.0 13 Jul 1991 11:19:12
//Initial revision.
//
*/
// Error codes
#define E_NOLANLIB 1
#define E_LANLIBL 2
#define E_NOVECTOR 3
#define E_NONETBIOS 4
#define E_NONOS 5
#define E_GETNAME 6
#define E_GETMSGVEC 7
#define E_SETMSGFLAG 8
#define E_SETMSGVEC 9
#define E_NONCB 10
#define E_NOLAN 11
#define E_NOHOST 12
#define E_GETMSGFLAG 13
#define E_GORES 14
#define E_NONAME 15
#define E_GETDOSVEC 16
#define E_SETDOSVEC 17
#define E_MSGERR 18
extern char *LANerr[]; // Error message table
extern int NOSerrno; // Holds most recent NOS error
// External shared routines
extern void FATAL(); // Error reporters
extern void FATALN();
extern void lanlibcheck(); // Check resident library is loaded
extern int sendmessage(); // Send a LAN message
extern void delay(); // Wait a specified time
// Copy a far buffer to a near place
extern void copyfartonear(char far *, char *, int);
extern void refreshnames(); // Update names of machines currently on the LAN
extern int addname(); // Add a single name to LAN table
extern void gennrsl(); // Generate NRSL descriptive string
extern void initnodetable();// Set up empty network node table
extern int nodenamecmp(); // Compare network node names
extern void far entercrit();// Enter a critical region
extern void far leavecrit();// Leave a critical region
// Message processing routine
extern void far msg_proc(struct message_buffer far *);
// Miscellaneous constants
#define FALSE 0
#define TRUE 1
#define D_TIMEOUT 30 // Default 30 sec timeout when waiting to sync
// with another host
#define D_DISPTICKS 182 // Display message for this # of ticks (10 secs)
#define D_DISPLINE 12 // Display message on this line
#define D_NODES 16 // Maximum # of nodes that we'll remember
#define D_lanbios 0x80 // NOSPresence() bit definitions
#define D_server 0x40
#define D_redir 0x08
#define D_lanpup 0x02
//
// Each entry in the workq structure holds information about the
// next item of work that must be done by the dowork() routine
// in LANRES.C
//
struct workq { // Definition of work to be done
struct workq *cpW; // Pointer to next work queue item
WORD wType; // Type of work to be done.
// 0 => unused entry
struct message_buffer M;// Copy of received message
};
// Routines to manipulate work queue entries
extern void freework(); // Free work queue item
extern struct workq *allocwork(); // Allocate an item
extern struct workq *nextwork(); // Get next work item
extern void initwork(); // Initialize work queue
//
// The work queue and msg stats structure only exist within LANRES.
//
// The msg stats structure collects information about message traffic
//
#ifdef BACKGROUND
extern struct workq workq[]; // Work queue
struct msgstats {
int msgbusy; // Counts # of times msg received while busy
int unknown; // Counts # of unidentified messages
int in; // Counts total # of messages received
int out; // Counts total of messages sent
int statusack; // Counts # of status acks
};
extern struct msgstats msgstats;
#endif
//
// Structure to hold details of active machines. Both LAN and
// LANRES keep one of these. The LAN copy is updated from the
// LANRES copy.
//
struct lannode {
char cpName[D_NAMESZ]; // Name of machine
WORD wFlags; // Flags that tell its status
};
extern struct lannode lannode[];
extern char cpNRSL[]; // String that defines what's loaded
// on this node.
//
// Message buffer types for the LAN program
// Must not conflict with MBT_* defined in NOS.H
//
#define MBT_base 100 // Start of message # range
#define MBT_LANtext 100 // Plain text message
#define MBT_LANwarmboot 101 // Warm reboot message
#define MBT_LANcoldboot 102 // Cold reboot message
#define MBT_LANstatus 103 // Send status enquiry message
#define MBT_LANsend 104 // Broadcast message
#define MBT_LANstatusack 106 // Response to status enquiry
#define MBT_LANunknown 107 // Unknown message
#define MBT_LANbootack 108 // Acknowledgement of boot message
#define MBT_LANbootden 109 // Denial of boot request
#define WARMBOOT 0x1234 // Special codes to identify boot types
#define COLDBOOT 0
#define D_WORKITEMS 8 // # of work items allowed for
// TesSeract related declarations
extern WORD TSRid; // Unique TSR id code
extern char *TSRIdStr; // TSR id string for TesSeRact